 package STOCK;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewJFrame.java
 *
 * Created on Aug 27, 2011, 1:38:44 PM
 */



import AFEED.RSSReader;
import RunableClass.AlertRunnable;
import RunableClass.useClass.Addport;
import Alert.AddAlert;
import Alert.ChkAlert;
import Alert.Fc;
import Alert.ST_name;
import FramePk.FramePk;
import IE.BrowserControl;
import InterNalFrame.CDMAChart;
import InterNalFrame.LineChart;
import InterNalFrame.RSIChart;
import InterNalFrame.candlestickChart;
import RunableClass.IndexRunnable;
import RunableClass.FavoriteRunnable;
import RunableClass.GetSymbolServer;
import RunableClass.GroupRunnable;
import RunableClass.NewsRunnable;
import RunableClass.PortRunnable;
import RunableClass.RankRunnable;
import RunableClass.ReadAlertRunnable;
import RunableClass.StockRunnable;
import RunableClass.useClass.NewsTbRunnable;
import RunableClass.useClass.VertifyGroup;
import about.about;
import com.jtattoo.demo.images.ImageHelper;
import com.jtattoo.plaf.BaseRootPaneUI;
import file.fileread.*;
import java.awt.*;
import java.awt.event.*;
import java.io.IOException;
import java.sql.SQLException;
import java.util.*;
import java.util.logging.*;
import javax.swing.*;
import javax.swing.table.*;
import mysql.connect;


/**
 *
 * @author TOMMYNATO
 */
public class STOCK extends javax.swing.JFrame {
    private JTitleCheckBox          checkBox            =   null;
    private JTitleButton            button              =   null,
                                    button1             =   null;
    private JTitleMenuButton        menuButton          =   null; 
            int                     checkindex          =   0;
    static  JMenuItem               News                =   new JMenuItem("News");
    static  JMenuItem               StockInfo           =   new JMenuItem("StockInfo");
    static  JMenuItem               Analysis            =   new JMenuItem("Analysis");
            int                     index2              =   1; 
            JPopupMenu              popupMenu           =   new JPopupMenu();
            JPopupMenu              txtSearchpopupMenu  =   new JPopupMenu();
            JPopupMenu              AlertpopupMenu      =   new JPopupMenu();
            JPopupMenu              GrouppopupMenu      =   new JPopupMenu();
            JPopupMenu              FapopupMenu         =   new JPopupMenu();
            JPopupMenu              PortpopupMenu       =   new JPopupMenu();
            JPopupMenu              feedpopupmenu       =   new JPopupMenu();
            javax.swing.Timer       TabNews ;
    private int                     Keypress; 
            Thread                  t5,
                                    t6,
                                    t7,
                                    t8,
                                    t9,
                                    t10,
                                    t11,
                                    t12,
                                    t13,
                                    t14,
                                    t15,
                                    T17,
                                    t18,
                                    t19;
             GetSymbolServer GS;
   public static String EMAPeriod="";
   public static String SMAPeriod="";
    public static String WMAPeriod="";
     public static String CDMAPeriod="";
    public STOCK() {
        initComponents();
     
   
     javax.swing.Timer timetoolbar = new javax.swing.Timer(1000, new ClockListener()); 
      timetoolbar.start();
   //  T17.start();
    ///////////////////Start SETINDEX///////////////////////////////////////////
RankRunnable RRun=new RankRunnable();
t15=new Thread(RRun);
  t15.start(); 
  t15.suspend();
      ///////////////////////////////////////////------------->
    FavoriteRunnable RDD=new FavoriteRunnable(TbFavorite);
    t12 = new Thread(RDD);
    t12.start();
 /////////////////////News1TbRunnable///////////////////////////////////////////
   StockRunnable RS=new StockRunnable(TbViewStock);
   t11 = new Thread(RS);
   /////////////////////IndexRunnable///////////////////////////////'////////////
  NewsRunnable NR=new NewsRunnable();
    t18= new Thread(NR);
  t18.start();
  /////////////////////IndexRunnable///////////////////////////////////////////
   IndexRunnable INR=new IndexRunnable();
  t9 = new Thread(INR);
    t9.start();
    /////////////////////////GroupRunnable//////////////////////////////
     GroupRunnable x = new GroupRunnable(TbGroup);
     t13=new Thread(x);
      t13.start();
    
/////////////////////NewsTbRunnable///////////////////////////////////////////
    JTable []SJT={TbNews,TbNews1};
    NewsTbRunnable NTR=new NewsTbRunnable(SJT);
    t8 = new Thread(NTR);
    t8.start();
  //////////////////////////////ReadData////////////////////////////////////
 AlertRunnable Rd=new AlertRunnable(TbListAlert);
   t5 = new Thread(Rd);
   t5.start();
   //////////////////////////PortRunable//////////////////////////////////////
   PortRunnable PR=new PortRunnable(TbPort);
   t7 = new Thread(PR);
   t7.start();
   ////////////////////////////////ReadData2value//////////////////////////////////
   ReadAlertRunnable R2d=new ReadAlertRunnable();
   t6 = new Thread(R2d);
   t6.start();
     ////////////////////////////////VertifyGroup//////////////////////////////////
   VertifyGroup VG =new VertifyGroup();
   t19 = new Thread(VG);
  
   ////////////////////////////popupMenu//////////////////////////////////////
      JMenuItem menuItem = new JMenuItem("View Full Text");
      
   
     popupMenu.add(menuItem);
    
   
     ////////////////////////////////////////////////////////////////////
      
     
      JMenuItem txtSearchmenuitem= new JMenuItem("Clear");
      JMenuItem txtSearchmenuitem0= new JMenuItem("Search");
     txtSearchpopupMenu.add(txtSearchmenuitem0);
     txtSearchpopupMenu.add(txtSearchmenuitem);
     
     //////////////////////////////////////////////////////////////////////
    // JMenuItem Alertmenuitem0= new JMenuItem("Add New Alert");
     JMenuItem Alertmenuitem1= new JMenuItem("Set Alert");
     JMenuItem Alertmenuitem2= new JMenuItem("Delete this Select");
     JMenuItem Alertmenuitem3= new JMenuItem("Delete All"); 
     JMenuItem Alertmenuitem4= new JMenuItem("Edit Alert");
     JSeparator Jse=new JSeparator();
    // AlertpopupMenu.add(Alertmenuitem0);
    // AlertpopupMenu.add(Jse);
     AlertpopupMenu.add(Alertmenuitem1);
     AlertpopupMenu.add(Jse);
     AlertpopupMenu.add(Alertmenuitem4);
     AlertpopupMenu.add(Jse);
     AlertpopupMenu.add(Alertmenuitem2);
     AlertpopupMenu.add(Alertmenuitem3);
     //////////////////////////////////////////////////////////
     JMenuItem Groupmenuitem1= new JMenuItem("View in web");
     GrouppopupMenu.add(Groupmenuitem1);
     
     
    
   //////////////////////////////////////////////
       JMenuItem Famenuitem2= new JMenuItem("Delete this Select");
     JMenuItem Famenuitem3= new JMenuItem("Delete All"); 
     FapopupMenu.add(Famenuitem2);
     FapopupMenu.add(Famenuitem3);
     ///////////////////////////////////////////////////////////////////
     
         // JMenuItem Alertmenuitem0= new JMenuItem("Add New Alert");
   
     JMenuItem Portmenuitem0= new JMenuItem("Delete this Select");
     JMenuItem Portmenuitem1= new JMenuItem("Delete All"); 
   
    // AlertpopupMenu.add(Alertmenuitem0);
    // AlertpopupMenu.add(Jse);
     PortpopupMenu.add(Portmenuitem0);
     PortpopupMenu.add(Jse);
     PortpopupMenu.add(Portmenuitem1);
    
     /////////////////////////////////////////////////////////////////
     
     
JMenuItem feeditem1=new JMenuItem("Open on web.");
            feedpopupmenu.add(feeditem1);
            feeditem1.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
               BrowserControl.displayURL(FeedLink);
              
            }
        });
     ///////////////////////////////////////////////////////////////////
     new AddAlert().GetAlert();
     
     //////////////////////////////////////////////
        JPanel contentPanel = new JPanel(new BorderLayout());
        contentPanel.setBorder(BorderFactory.createEmptyBorder(0, 4, 4, 4));
     
     //   checkBox = new JTitleCheckBox("Check");
      //  button = new JTitleButton("Button");
      //   button1 = new JTitleButton("remove");
        menuButton = new JTitleMenuButton("Menu");
 
        // add listeners
        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });

/*        checkBox.addActionListener(new ActionListener() {
           
            public void actionPerformed(ActionEvent e) {
               ++checkindex;
              //  JOptionPane.showMessageDialog(STOCK.this, "CheckBox clicked");
           
           
                
               
            }
        });*/
/*        button.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                // jTabbedPane1.addTab("fdfd"+index2,new JPanel(true));
                // index2++;
                //JOptionPane.showMessageDialog(STOCK.this, "Button clicked");
            }
        });*/
        
        
        Groupmenuitem1.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
             BrowserControl.displayURL(GroupURL);
            }
        });
        
         Alertmenuitem1.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              ChkAlert ChkAlert=  new ChkAlert(new JFrame(),true);
              ChkAlert.setIdchk(DelTbAlert[0]);
              ChkAlert.setVisible(true);
            }
        });
        
         Alertmenuitem2.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                int reply=javax.swing.JOptionPane.showConfirmDialog(null,"Do you want delete this record?","Delete this Record",JOptionPane.YES_NO_OPTION);
                if(reply==JOptionPane.YES_NO_OPTION){
                    connect dbcon=new connect(); 
                  
                        
           String    sqlsec=" DELETE FROM `stock_ alert` WHERE stockname='"+DelTbAlert[0]+"' AND (value='"+DelTbAlert[1]+"')";
           System.out.println(sqlsec);
                    try {
                        
                      int a=  dbcon.stmt.executeUpdate(sqlsec);
                      if(a>0){
                          javax.swing.JOptionPane.showMessageDialog(null, "Delete complete!","Delete!",JOptionPane.CLOSED_OPTION);
                      }
                        
                    } catch (SQLException ex) {
                    }
                     new AddAlert().GetAlert();
                     
                       dbcon.CloseDB();
                       
                }
                
            }
        });
         Alertmenuitem3.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                int reply=javax.swing.JOptionPane.showConfirmDialog(null,"Do you want delete all record?","Delete all Record",JOptionPane.YES_NO_OPTION);
                if(reply==JOptionPane.YES_NO_OPTION){
                    connect dbcon=new connect(); 
                  
                        
           String    sqlsec=" TRUNCATE TABLE   `stock_ alert`";// WHERE stockname='"+DelTbAlert[0]+"' AND (value='"+DelTbAlert[1]+"')";
           System.out.println(sqlsec);
                    try {
                        
                      int a=  dbcon.stmt.executeUpdate(sqlsec);
                      if(a>0){
                          javax.swing.JOptionPane.showMessageDialog(null, "Delete complete!","Delete!",JOptionPane.CLOSED_OPTION);
                      }
                        
                    } catch (SQLException ex) {
                    }
                     new AddAlert().GetAlert();
                     
                       dbcon.CloseDB();
                       
                }
                
            }
        });
          Alertmenuitem4.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
        
              AddAlert AddAlert=  new AddAlert(new JFrame(),true);
              AddAlert.setId(DelTbAlert[0]);
              AddAlert.setVisible(true);
            }
        });
         
         ////////////////////////////////////////////////////////////
            Famenuitem2.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                int reply=javax.swing.JOptionPane.showConfirmDialog(null,"Do you want delete this record?","Delete this Record",JOptionPane.YES_NO_OPTION);
                if(reply==JOptionPane.YES_NO_OPTION){
                    connect dbcon=new connect(); 
                  
                        

           String    sqlsec=" DELETE FROM `stock_favorite` WHERE SymbolName='"+DelTbFavorite[0]+"'";
           System.out.println(sqlsec);
                    try {
                        
                      int a=  dbcon.stmt.executeUpdate(sqlsec);
                      if(a>0){
                          javax.swing.JOptionPane.showMessageDialog(null, "Delete complete!","Delete!",JOptionPane.CLOSED_OPTION);
                      }
                        
                    } catch (SQLException ex) {
                    }
                  //   new AddAlert().GetAlert();
                     
                       dbcon.CloseDB();
                       
                }
                
            }
        });
         Famenuitem3.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                int reply=javax.swing.JOptionPane.showConfirmDialog(null,"Do you want delete all record?","Delete all Record",JOptionPane.YES_NO_OPTION);
                if(reply==JOptionPane.YES_NO_OPTION){
                    connect dbcon=new connect(); 
                  
                        
           String    sqlsec=" TRUNCATE TABLE   `stock_favorite`";// WHERE stockname='"+DelTbAlert[0]+"' AND (value='"+DelTbAlert[1]+"')";
           System.out.println(sqlsec);
                    try {
                        
                      int a=  dbcon.stmt.executeUpdate(sqlsec);
                      if(a>0){
                          javax.swing.JOptionPane.showMessageDialog(null, "Delete complete!","Delete!",JOptionPane.CLOSED_OPTION);
                      }
                        
                    } catch (SQLException ex) {
                    }
                   //  new AddAlert().GetAlert();
                     
                       dbcon.CloseDB();
                       
                }
                
            }
        });
         
         ////
         ////////////////////////////////////////////////////////////
         Portmenuitem0.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                t7.suspend();
                int reply=javax.swing.JOptionPane.showConfirmDialog(null,"Do you want delete this record?","Delete this Record",JOptionPane.YES_NO_OPTION);
                if(reply==JOptionPane.YES_NO_OPTION){
                    connect dbcon=new connect(); 
                  
                        
           String    sqlsec=" DELETE FROM stock_port WHERE SymbolName='"+DelTbport[0]+"'";
            System.out.println(sqlsec);
                    try {
                        
                      int a=  dbcon.stmt.executeUpdate(sqlsec);
                      if(a>0){
                          javax.swing.JOptionPane.showMessageDialog(null, "Delete complete!","Delete!",JOptionPane.CLOSED_OPTION);
                      }
                        
                    } catch (SQLException ex) {
                    }
                  new AddAlert().GetAlert();
                     
                     dbcon.CloseDB();
                       
                }
                t7.resume();
            }
            
        });
           Portmenuitem1.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                t7.suspend();
                int reply=javax.swing.JOptionPane.showConfirmDialog(null,"Do you want delete all record?","Delete all Record",JOptionPane.YES_NO_OPTION);
                if(reply==JOptionPane.YES_NO_OPTION){
                    connect dbcon=new connect(); 
                  
                        
           String    sqlsec=" TRUNCATE TABLE   stock_port";// WHERE stockname='"+DelTbAlert[0]+"' AND (value='"+DelTbAlert[1]+"')";
           System.out.println(sqlsec);
                    try {
                        
                      int a=  dbcon.stmt.executeUpdate(sqlsec);
                      if(a>0){
                          javax.swing.JOptionPane.showMessageDialog(null, "Delete complete!","Delete!",JOptionPane.CLOSED_OPTION);
                      }
                        
                    } catch (SQLException ex) {
                    }
                   //  new AddAlert().GetAlert();
                     
                       dbcon.CloseDB();
                       
                }
               t7.resume(); 
            }
        });
                
        txtSearchmenuitem.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
               txtSearch.setText("");
            }
        });
        txtSearchmenuitem0.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                   txtNewSearch();
            }
        });
/*      Alertmenuitem0.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                AddAlert addAlert = new AddAlert(null,true);
                addAlert.show();
              
               
            }
        });*/
/*         button1.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                // jTabbedPane1.removeTabAt(0);
                 
                //JOptionPane.showMessageDialog(STOCK.this, "Button clicked");
            }
        });*/
            menuItem.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                try {
          String sqlsec="SELECT * FROM `stock_news` Where (DateTime='"+TbNews.getValueAt(  TbNews.getSelectedRow(),0 )+"' AND (Company='"+TbNews.getValueAt(  TbNews.getSelectedRow(),1 )+"' And Title='"+TbNews.getValueAt(  TbNews.getSelectedRow(),2 )+"'))";
                connect a=   new connect();
                  a.rs= a.stmt.executeQuery(sqlsec);
                 a.rs.next();
                BrowserControl.displayURL(a.rs.getString("Link"));



       } catch (SQLException ex) {
           ex.printStackTrace();
       }
         
            }
        });
        
 
         
         
         
        // show application
      Toolkit tk = Toolkit.getDefaultToolkit();
    Dimension screenSize = tk.getScreenSize();
    int screenHeight = screenSize.height;
    int screenWidth = screenSize.width;
   
STOCK Obj=new STOCK("New Maximize");
   Obj.setExtendedState(Obj.getExtendedState()|JFrame.MAXIMIZED_VERT);
    setSize(screenWidth, screenHeight-38);
    setLocation(0, 0);
    setVisible(true);
 if (getRootPane().getUI() instanceof BaseRootPaneUI) {
            BaseRootPaneUI rootPaneUI = (BaseRootPaneUI)getRootPane().getUI();
            TitlePaneLayout layout = new TitlePaneLayout();
            JPanel panel = new JPanel(layout);
            panel.setOpaque(false);
           // panel.add(checkBox);
           // panel.add(button);
            //panel.add(button1);
            panel.add(menuButton);
            rootPaneUI.getTitlePane().setCustomizedTitlePanel(panel);
      
        }
 

       
         
        
        
        
    }

    private STOCK(String string) {
       
    }
 

    
  public class JTitleCheckBox extends JCheckBox {

        public JTitleCheckBox(String title) {
            super(title);
            setForeground(UIManager.getColor("activeCaptionText"));
            setOpaque(false);
            setFocusable(false);
        }
    }
 public class JTitleButton extends JButton {

        public JTitleButton(String title) {
            super(title);
            setFocusable(false);
        }

    }
 public class JTitleMenuButton extends JButton {

        public JTitleMenuButton(String title) {
            super(title, ImageHelper.loadImage("DownArrow.gif"));

            setHorizontalAlignment(SwingConstants.CENTER);
            setHorizontalTextPosition(SwingConstants.LEFT);
            setForeground(UIManager.getColor("activeCaptionText"));
            setContentAreaFilled(false);
            setBorderPainted(false);
            setFocusable(false);
            
            addMouseListener(new MouseAdapter() {

                public void mouseEntered(MouseEvent e) {
                    setForeground(Color.black);
                    setContentAreaFilled(true);
                }

                public void mouseExited(MouseEvent e) {
                    setForeground(UIManager.getColor("activeCaptionText"));
                    setContentAreaFilled(false);
                }
            });

            addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    showPopup();
                }
            });
        }

        private void showPopup() {
            JPopupMenu popupMenu = new JPopupMenu();
           // JMenu menuItem1 = new JMenu("A1"); 
                      //  JMenuItem item1=new JMenuItem("item 1");
                    //   menuItem1.add(item1);
                        //menuItem1.add(new JMenuItem("item 2"));
                        //menuItem1.add(new JMenuItem("item 3"));
            //JMenu menuItem2 = new JMenu("UDS");
                       // menuItem2.add(new JMenuItem("item 1"));
                        //menuItem2.add(new JMenuItem("item 2"));
                        //menuItem2.add(new JMenuItem("item 3"));
            JMenu menuItem3 = new JMenu("Setting");
            
                       menuItem3.add(new JMenuItem("Database Setting"));
                       menuItem3.add(new JMenuItem("Timer Setting"));
                       
           // JMenu menuItem4 = new JMenu();
            JMenuItem MT=new JMenuItem("About us");
          //  m//enuItem4.add(MT);
            
           // popupMenu.add(menuItem1);
           // popupMenu.addSeparator();
           // popupMenu.add(menuItem2);
           // popupMenu.addSeparator();
            popupMenu.add(menuItem3);
            popupMenu.addSeparator();
            popupMenu.add(MT);
//            
            MT.addActionListener(new ActionListener() {
                
                public void actionPerformed(ActionEvent e) {
                  
              about about=  new about(new JFrame(),true);
              about.setVisible(true);
                }
            });
           
//            
//            menuItem2.addActionListener(new ActionListener() {
//
//                public void actionPerformed(ActionEvent e) {
//                }
//            });
//            
            menuItem3.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    JOptionPane.showMessageDialog(STOCK.this, "Menu #3 clicked");
                }
            });
           
            popupMenu.show(this, 0, getHeight() - 1);
        }

    }
  public class TitlePaneLayout implements LayoutManager {

        public void addLayoutComponent(String name, Component comp) {
        }

        public void removeLayoutComponent(Component comp) {
        }

        public Dimension preferredLayoutSize(Container parent) {
            return parent.getSize();
        }

        public Dimension minimumLayoutSize(Container parent) {
            return parent.getMinimumSize();
        }

        public void layoutContainer(Container parent) {
            int width = 0;
            int count = parent.getComponentCount();
            int w[] = new int[count];
            for (int i = 0; i < count; i++) {
                Component c = parent.getComponent(i);
                if (c.isVisible()) {
                    w[i] = c.getPreferredSize().width;
                    width += w[i];
                    width += 4;
                }
            }
            int x = parent.getWidth() - width;
            if (!parent.getComponentOrientation().isLeftToRight()) {
                x = 0;
            }
            int y = 0;
            int h = parent.getHeight() - 2;
            for (int i = 0; i < count; i++) {
                Component c = parent.getComponent(i);
                if (c.isVisible()) {
                    c.setBounds(x, y, w[i], h);
                    x += w[i] + 4;
                }
            }
        }

    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel11 = new javax.swing.JPanel();
        jLabel8 = new javax.swing.JLabel();
        txtSymbol3 = new javax.swing.JTextField();
        btview = new javax.swing.JLabel();
        jScrollPane8 = new javax.swing.JScrollPane();
        TbViewStock = new javax.swing.JTable();
        jLabel9 = new javax.swing.JLabel();
        txtGroup = new javax.swing.JTextField();
        txtwaiting = new javax.swing.JLabel();
        jPanel17 = new javax.swing.JPanel();
        jScrollPane7 = new javax.swing.JScrollPane();
        TbNews1 = new javax.swing.JTable(){
            public Component prepareRenderer
            (TableCellRenderer renderer,int Index_row, int Index_col) {
                Component comp = super.prepareRenderer(renderer, Index_row, Index_col);
                //even index, selected or not selected
                if (Index_row % 2 == 0&& !isCellSelected(Index_row, Index_col)) {

                    comp.setBackground(Color.WHITE);
                }else if ((Index_row % 2 == 0||Index_row % 2 ==1)&& isCellSelected(Index_row, Index_col)) {

                    comp.setBackground(Color.YELLOW);
                }
                else {
                    comp.setBackground(Color.lightGray);
                }
                return comp;
            }

        };
        jPanel14 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        TbFavorite = new javax.swing.JTable(){
            public Component prepareRenderer
            (TableCellRenderer renderer,int Index_row, int Index_col) {
                Component comp = super.prepareRenderer(renderer, Index_row, Index_col);
                //even index, selected or not selected
                comp.setForeground(Color.BLACK);
                if (Index_row % 2 == 0&& !isCellSelected(Index_row, Index_col)) {

                    comp.setBackground(Color.WHITE);
                }else if ((Index_row % 2 == 0||Index_row % 2 ==1)&& isCellSelected(Index_row, Index_col)) {

                    comp.setBackground(Color.YELLOW);
                }
                else {
                    comp.setBackground(Color.lightGray);
                }
                return comp;
            }

        }

        ;
        jLabel12 = new javax.swing.JLabel();
        txtfavorite = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jSeparator4 = new javax.swing.JSeparator();
        jPanel3 = new javax.swing.JPanel();
        cbAnalysis = new javax.swing.JComboBox();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        txtinterval = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        txtsymbol = new javax.swing.JTextField();
        txtwating = new javax.swing.JLabel();
        jPanel18 = new javax.swing.JPanel();
        jPanel19 = new javax.swing.JPanel();
        CbOpen = new javax.swing.JCheckBox();
        CbHigh = new javax.swing.JCheckBox();
        CbLow = new javax.swing.JCheckBox();
        jCheckBox5 = new javax.swing.JCheckBox();
        CbClose = new javax.swing.JCheckBox();
        jPanel20 = new javax.swing.JPanel();
        CbSMA = new javax.swing.JCheckBox();
        CbEMA = new javax.swing.JCheckBox();
        CbWMA = new javax.swing.JCheckBox();
        jCheckBox7 = new javax.swing.JCheckBox();
        jPanel21 = new javax.swing.JPanel();
        EXCandleStick = new javax.swing.JCheckBox();
        EXLineChart = new javax.swing.JCheckBox();
        EXMACD = new javax.swing.JCheckBox();
        EXRSI = new javax.swing.JCheckBox();
        ChartLine = new javax.swing.JDesktopPane();
        ChartRSI = new javax.swing.JDesktopPane();
        btChart = new javax.swing.JButton();
        ChartCandle = new javax.swing.JDesktopPane();
        ChartCDMA = new javax.swing.JDesktopPane();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        TbNews = new javax.swing.JTable(){
            public Component prepareRenderer
            (TableCellRenderer renderer,int Index_row, int Index_col) {
                Component comp = super.prepareRenderer(renderer, Index_row, Index_col);
                //even index, selected or not selected
                if (Index_row % 2 == 0&& !isCellSelected(Index_row, Index_col)) {

                    comp.setBackground(Color.WHITE);
                }else if ((Index_row % 2 == 0||Index_row % 2 ==1)&& isCellSelected(Index_row, Index_col)) {

                    comp.setBackground(Color.YELLOW);
                }
                else {
                    comp.setBackground(Color.lightGray);
                }
                return comp;
            }
        };
        jPanel6 = new javax.swing.JPanel();
        LbSearch = new javax.swing.JLabel();
        cbSearch = new javax.swing.JComboBox();
        lbtext = new javax.swing.JLabel();
        txtSearch = new javax.swing.JTextField();
        btSearch = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        TbAlert = new javax.swing.JTable()
        ;
        jPanel7 = new javax.swing.JPanel();
        txtSymbol = new javax.swing.JTextField();
        lbSymbol = new javax.swing.JLabel();
        txtvalues = new javax.swing.JTextField();
        lbvalues = new javax.swing.JLabel();
        lbFilePath = new javax.swing.JLabel();
        btBrowser = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        btaddalert = new javax.swing.JLabel();
        lbvalues1 = new javax.swing.JLabel();
        txtvalues1 = new javax.swing.JTextField();
        jPanel8 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        TbListAlert = new javax.swing.JTable(){
            public Component prepareRenderer
            (TableCellRenderer renderer,int Index_row, int Index_col) {
                Component comp = super.prepareRenderer(renderer, Index_row, Index_col);
                //even index, selected or not selected
                if (Index_row % 2 == 0&& !isCellSelected(Index_row, Index_col)) {

                    comp.setBackground(Color.WHITE);
                }else if ((Index_row % 2 == 0||Index_row % 2 ==1)&& isCellSelected(Index_row, Index_col)) {

                    comp.setBackground(Color.YELLOW);
                }
                else {
                    comp.setBackground(Color.lightGray);
                }
                return comp;
            }
        }
        ;
        jPanel10 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        lbSymbol2 = new javax.swing.JLabel();
        lbvalue2 = new javax.swing.JLabel();
        jPanel13 = new javax.swing.JPanel();
        jLabel15 = new javax.swing.JLabel();
        txtaddport = new javax.swing.JTextField();
        jScrollPane6 = new javax.swing.JScrollPane();
        TbPort = new javax.swing.JTable(){
            public Component prepareRenderer
            (TableCellRenderer renderer,int Index_row, int Index_col) {
                Component comp = super.prepareRenderer(renderer, Index_row, Index_col);
                //even index, selected or not selected
                if (Index_row % 2 == 0&& !isCellSelected(Index_row, Index_col)) {

                    comp.setBackground(Color.WHITE);
                }else if ((Index_row % 2 == 0||Index_row % 2 ==1)&& isCellSelected(Index_row, Index_col)) {

                    comp.setBackground(Color.YELLOW);
                }
                else {
                    comp.setBackground(Color.lightGray);
                }
                return comp;
            }
        }
        ;
        jLabel16 = new javax.swing.JLabel();
        txtportamount = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jPanel12 = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        TbGroup = new javax.swing.JTable(){
            public Component prepareRenderer
            (TableCellRenderer renderer,int Index_row, int Index_col) {
                Component comp = super.prepareRenderer(renderer, Index_row, Index_col);
                //even index, selected or not selected
                String SetV=this.getValueAt(Index_row, 0).toString();
                if (SetV.contains("-")&&!isCellSelected(Index_row, Index_col)) {

                    comp.setBackground(Color.ORANGE);
                }else if(isCellSelected(Index_row, Index_col)){
                    comp.setBackground(Color.YELLOW);
                    comp.setForeground(Color.BLACK);
                }
                else{

                    comp.setBackground(Color.LIGHT_GRAY);
                }
                /*else if ((Index_row % 2 == 0||Index_row % 2 ==1)&& isCellSelected(Index_row, Index_col)) {

                    comp.setBackground(Color.YELLOW);
                }
                else {
                    comp.setBackground(Color.lightGray);
                }*/
                return comp;
            }
        }

        ;
        jPanel15 = new javax.swing.JPanel();
        jPanel16 = new javax.swing.JPanel();
        lbranktype = new javax.swing.JLabel();
        cbranktype = new javax.swing.JComboBox();
        lbranking = new javax.swing.JLabel();
        jScrollPane9 = new javax.swing.JScrollPane();
        TbRank = new javax.swing.JTable(){
            public Component prepareRenderer
            (TableCellRenderer renderer,int Index_row, int Index_col) {
                Component comp = super.prepareRenderer(renderer, Index_row, Index_col);
                //even index, selected or not selected
                if (Index_row % 2 == 0&& !isCellSelected(Index_row, Index_col)) {

                    comp.setBackground(Color.WHITE);
                }else if ((Index_row % 2 == 0||Index_row % 2 ==1)&& isCellSelected(Index_row, Index_col)) {

                    comp.setBackground(Color.YELLOW);
                    comp.setForeground(Color.BLACK);
                }
                else {
                    comp.setBackground(Color.lightGray);
                }
                return comp;
            }
        };
        jToolBar1 = new javax.swing.JToolBar();
        jLabel17 = new javax.swing.JLabel();
        IPHostName = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JToolBar.Separator();
        lbtime = new javax.swing.JLabel();
        lbtxttime = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JToolBar.Separator();
        jLabel3 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jSeparator3 = new javax.swing.JToolBar.Separator();
        jLabel18 = new javax.swing.JLabel();
        jProgressBar1 = new javax.swing.JProgressBar();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jPanel9 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        index = new javax.swing.JTextField();
        Now = new javax.swing.JTextField();
        lbmkv = new javax.swing.JTextField();
        MkV = new javax.swing.JTextField();
        lbhigh = new javax.swing.JTextField();
        lw = new javax.swing.JTextField();
        hg = new javax.swing.JTextField();
        lblow = new javax.swing.JTextField();
        lbchange = new javax.swing.JTextField();
        txtchg = new javax.swing.JTextField();
        lbpchg = new javax.swing.JTextField();
        txtpchg = new javax.swing.JTextField();
        lbvol = new javax.swing.JTextField();
        txtvol = new javax.swing.JTextField();
        lbstatus = new javax.swing.JTextField();
        txtstatus = new javax.swing.JTextField();
        txttime = new javax.swing.JTextField();
        lbtime1 = new javax.swing.JTextField();

        jLabel1.setText("jLabel1");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("STOCK EXCHANGE DECISION SUPPORT SYSTEM");
        setBackground(new java.awt.Color(153, 153, 153));
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowActivated(java.awt.event.WindowEvent evt) {
                formWindowActivated(evt);
            }
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });
        addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentResized(java.awt.event.ComponentEvent evt) {
                formComponentResized(evt);
            }
        });

        jTabbedPane1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTabbedPane1MouseClicked(evt);
            }
        });

        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder("View"));

        jLabel8.setText("SymbolName :");

        txtSymbol3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                txtSymbol3MouseClicked(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                txtSymbol3MouseExited(evt);
            }
        });
        txtSymbol3.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtSymbol3KeyTyped(evt);
            }
        });

        btview.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/StockWatcher.png"))); // NOI18N
        btview.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btviewMouseClicked(evt);
            }
        });

        TbViewStock.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        TbViewStock.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        TbViewStock.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null, null, null, null, null}
            },
            new String [] {
                "SymbolName","Mark","Open","High","Low","Value","Chg","%Chg","Bids","Offer","Mk.Vol","Mk.Val('000)"
            }
        ));
        TbViewStock.setAutoscrolls(false);
        TbViewStock.setEnabled(false);
        TbViewStock.setGridColor(new java.awt.Color(0, 0, 0));
        jScrollPane8.setViewportView(TbViewStock);

        jLabel9.setText("Group :");

        txtGroup.setBackground(new java.awt.Color(0, 0, 0));
        txtGroup.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        txtGroup.setForeground(new java.awt.Color(102, 204, 0));
        txtGroup.setDisabledTextColor(new java.awt.Color(51, 153, 0));
        txtGroup.setEnabled(false);

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane8)
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtSymbol3, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtwaiting)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btview)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtGroup, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel8)
                        .addComponent(txtSymbol3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtwaiting, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(btview, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel9)
                        .addComponent(txtGroup, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane8, javax.swing.GroupLayout.DEFAULT_SIZE, 54, Short.MAX_VALUE))
        );

        jPanel17.setBorder(javax.swing.BorderFactory.createTitledBorder("News"));

        TbNews1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        TbNews1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        TbNews1.setSelectionBackground(new java.awt.Color(0, 0, 0));
        TbNews1.setSelectionForeground(new java.awt.Color(0, 0, 0));
        jScrollPane7.setViewportView(TbNews1);

        javax.swing.GroupLayout jPanel17Layout = new javax.swing.GroupLayout(jPanel17);
        jPanel17.setLayout(jPanel17Layout);
        jPanel17Layout.setHorizontalGroup(
            jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel17Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane7, javax.swing.GroupLayout.DEFAULT_SIZE, 1298, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel17Layout.setVerticalGroup(
            jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane7, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE)
        );

        jPanel14.setBorder(javax.swing.BorderFactory.createTitledBorder("Add Favorite"));

        TbFavorite.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        TbFavorite.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {}
            },
            new String [] {

            }
        ));
        TbFavorite.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TbFavoriteMouseClicked(evt);
            }
        });
        jScrollPane4.setViewportView(TbFavorite);

        jLabel12.setText("SymboName :");

        txtfavorite.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                txtfavoriteMouseClicked(evt);
            }
        });

        jLabel13.setBackground(new java.awt.Color(102, 102, 102));
        jLabel13.setText("Add");
        jLabel13.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabel13MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
        jPanel14.setLayout(jPanel14Layout);
        jPanel14Layout.setHorizontalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel14Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSeparator4, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel14Layout.createSequentialGroup()
                        .addComponent(jLabel12)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtfavorite, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel13))
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 1278, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel14Layout.setVerticalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel14Layout.createSequentialGroup()
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(txtfavorite, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("StockWatch", new javax.swing.ImageIcon(getClass().getResource("/images/StockWatcher.png")), jPanel1); // NOI18N

        cbAnalysis.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Year", "Month", "Day" }));

        jLabel10.setText("Type :");

        jLabel11.setText("Interval  : ");

        txtinterval.setText("1");

        jLabel14.setText("Symbol :");

        txtsymbol.setText("PTT");
        txtsymbol.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                txtsymbolMouseClicked(evt);
            }
        });
        txtsymbol.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtsymbolKeyPressed(evt);
            }
        });

        jPanel18.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jPanel19.setBorder(javax.swing.BorderFactory.createTitledBorder("normal Line"));

        CbOpen.setText("Open");
        CbOpen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CbOpenActionPerformed(evt);
            }
        });

        CbHigh.setText("High");
        CbHigh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CbHighActionPerformed(evt);
            }
        });

        CbLow.setText("Low");
        CbLow.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CbLowActionPerformed(evt);
            }
        });

        jCheckBox5.setText("Values(Type Day)");
        jCheckBox5.setEnabled(false);

        CbClose.setText("Close");
        CbClose.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CbCloseActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel19Layout = new javax.swing.GroupLayout(jPanel19);
        jPanel19.setLayout(jPanel19Layout);
        jPanel19Layout.setHorizontalGroup(
            jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel19Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(CbOpen)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(CbHigh)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(CbLow)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(CbClose)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox5)
                .addContainerGap())
        );
        jPanel19Layout.setVerticalGroup(
            jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel19Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(CbOpen)
                    .addComponent(CbHigh)
                    .addComponent(CbLow)
                    .addComponent(CbClose)
                    .addComponent(jCheckBox5))
                .addContainerGap())
        );

        jPanel20.setBorder(javax.swing.BorderFactory.createTitledBorder("MOVING AVERAGE "));

        CbSMA.setText("SMA");
        CbSMA.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CbSMAActionPerformed(evt);
            }
        });

        CbEMA.setText("EMA");
        CbEMA.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CbEMAActionPerformed(evt);
            }
        });

        CbWMA.setText("WMA");
        CbWMA.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CbWMAActionPerformed(evt);
            }
        });

        jCheckBox7.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jCheckBox7.setText("LR");
        jCheckBox7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox7ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel20Layout = new javax.swing.GroupLayout(jPanel20);
        jPanel20.setLayout(jPanel20Layout);
        jPanel20Layout.setHorizontalGroup(
            jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel20Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(CbEMA)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(CbSMA)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(CbWMA)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jCheckBox7)
                .addContainerGap(61, Short.MAX_VALUE))
        );
        jPanel20Layout.setVerticalGroup(
            jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel20Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(CbEMA)
                    .addComponent(CbSMA)
                    .addComponent(CbWMA)
                    .addComponent(jCheckBox7))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel21.setBorder(javax.swing.BorderFactory.createTitledBorder("EXTEND WONDOWS"));

        EXCandleStick.setText("CandleStick");
        EXCandleStick.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EXCandleStickActionPerformed(evt);
            }
        });

        EXLineChart.setText("LineChart");
        EXLineChart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EXLineChartActionPerformed(evt);
            }
        });

        EXMACD.setText("MACD");
        EXMACD.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EXMACDActionPerformed(evt);
            }
        });

        EXRSI.setText("RSI");
        EXRSI.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EXRSIActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel21Layout = new javax.swing.GroupLayout(jPanel21);
        jPanel21.setLayout(jPanel21Layout);
        jPanel21Layout.setHorizontalGroup(
            jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel21Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(EXLineChart)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(EXCandleStick)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(EXMACD)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(EXRSI))
        );
        jPanel21Layout.setVerticalGroup(
            jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel21Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(EXLineChart)
                    .addComponent(EXCandleStick)
                    .addComponent(EXMACD)
                    .addComponent(EXRSI))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel18Layout = new javax.swing.GroupLayout(jPanel18);
        jPanel18.setLayout(jPanel18Layout);
        jPanel18Layout.setHorizontalGroup(
            jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel18Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel19, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel20, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel18Layout.setVerticalGroup(
            jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel18Layout.createSequentialGroup()
                .addGroup(jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel20, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel19, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel21, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        ChartLine.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ChartLineMouseClicked(evt);
            }
        });

        btChart.setText("View");
        btChart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btChartActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ChartLine)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel14)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtsymbol, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(10, 10, 10)
                        .addComponent(txtwating, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cbAnalysis, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtinterval, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btChart))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(ChartCandle, javax.swing.GroupLayout.PREFERRED_SIZE, 634, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(ChartCDMA, javax.swing.GroupLayout.DEFAULT_SIZE, 670, Short.MAX_VALUE)
                            .addComponent(ChartRSI, javax.swing.GroupLayout.DEFAULT_SIZE, 690, Short.MAX_VALUE)))
                    .addComponent(jPanel18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cbAnalysis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel10)
                            .addComponent(jLabel11)
                            .addComponent(txtinterval, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btChart)))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel14)
                            .addComponent(txtsymbol, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(15, 15, 15)
                        .addComponent(txtwating, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel18, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(ChartLine, javax.swing.GroupLayout.DEFAULT_SIZE, 371, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(ChartCDMA)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ChartRSI, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(ChartCandle, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jTabbedPane1.addTab("Tachnical Chart", new javax.swing.ImageIcon(getClass().getResource("/images/Diagram-icon.png")), jPanel3); // NOI18N

        TbNews.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        TbNews.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        TbNews.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
        TbNews.setSelectionBackground(new java.awt.Color(0, 0, 0));
        TbNews.setSelectionForeground(new java.awt.Color(0, 0, 0));
        TbNews.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION);
        TbNews.getTableHeader().setReorderingAllowed(false);
        TbNews.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TbNewsMouseClicked(evt);
            }
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                TbNewsMouseReleased(evt);
            }
        });
        jScrollPane1.setViewportView(TbNews);

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Search", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, java.awt.Color.blue));

        LbSearch.setText("Search By");

        cbSearch.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "DateTime", "Company", "Title" }));
        cbSearch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbSearchActionPerformed(evt);
            }
        });

        lbtext.setText("Text");

        txtSearch.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                txtSearchMouseClicked(evt);
            }
        });
        txtSearch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtSearchActionPerformed(evt);
            }
        });

        btSearch.setText("Search");
        btSearch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btSearchActionPerformed(evt);
            }
        });

        jButton1.setText("Reset News");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(LbSearch)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cbSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbtext)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 553, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btSearch)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton1)
                .addContainerGap(372, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(LbSearch)
                    .addComponent(cbSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbtext)
                    .addComponent(txtSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btSearch)
                    .addComponent(jButton1))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1)
                    .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 576, Short.MAX_VALUE)
                .addGap(19, 19, 19))
        );

        jTabbedPane1.addTab("News", new javax.swing.ImageIcon(getClass().getResource("/images/ANEWS001_33.png")), jPanel4); // NOI18N

        TbAlert.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        TbAlert.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null}
            },
            new String [] {
                "SymbolName", "Lower", "Upper", "Sound"
            }
        ));
        TbAlert.setSelectionBackground(new java.awt.Color(153, 153, 153));
        TbAlert.setSelectionForeground(new java.awt.Color(0, 0, 0));
        TbAlert.setVerifyInputWhenFocusTarget(false);
        TbAlert.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TbAlertMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(TbAlert);

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Add Alert"));

        txtSymbol.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
        txtSymbol.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                txtSymbolMouseClicked(evt);
            }
        });
        txtSymbol.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtSymbolActionPerformed(evt);
            }
        });
        txtSymbol.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtSymbolKeyPressed(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtSymbolKeyTyped(evt);
            }
        });

        lbSymbol.setText("Symbol :");

        txtvalues.setEnabled(false);

        lbvalues.setText("Low :");

        lbFilePath.setText("..");
        lbFilePath.setEnabled(false);

        btBrowser.setText("...");
        btBrowser.setToolTipText("");
        btBrowser.setEnabled(false);
        btBrowser.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btBrowser.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btBrowserActionPerformed(evt);
            }
        });

        jLabel4.setText("SoundType :");

        btaddalert.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Button White Add.png"))); // NOI18N
        btaddalert.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btaddalertMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                btaddalertMouseEntered(evt);
            }
        });

        lbvalues1.setText("Up :");

        txtvalues1.setEnabled(false);
        txtvalues1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtvalues1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(lbSymbol)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtSymbol, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lbvalues)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtvalues, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lbvalues1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtvalues1, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbFilePath, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btBrowser, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btaddalert)
                .addGap(99, 99, 99))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbSymbol)
                    .addComponent(txtSymbol, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbvalues)
                    .addComponent(txtvalues, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbvalues1)
                    .addComponent(txtvalues1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4)
                    .addComponent(lbFilePath, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btBrowser))
                .addContainerGap(28, Short.MAX_VALUE))
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addComponent(btaddalert, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );

        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Symbol Status", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(102, 102, 102)));

        TbListAlert.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        TbListAlert.setSelectionBackground(new java.awt.Color(0, 0, 0));
        TbListAlert.setSelectionForeground(new java.awt.Color(0, 0, 0));
        jScrollPane3.setViewportView(TbListAlert);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 326, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 613, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder("Symbol value"));

        jLabel6.setText("Value :");

        jLabel7.setText("Symbol :");

        lbSymbol2.setText("..");

        lbvalue2.setText("..");

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbSymbol2, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbvalue2, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE))
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jLabel6)
                    .addComponent(lbSymbol2)
                    .addComponent(lbvalue2))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, 647, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 966, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jPanel7, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 556, Short.MAX_VALUE)))
                .addContainerGap())
        );

        jTabbedPane1.addTab("AlertTask", new javax.swing.ImageIcon(getClass().getResource("/images/Info.png")), jPanel5); // NOI18N

        jLabel15.setText("Add Symbol :");

        txtaddport.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                txtaddportMouseClicked(evt);
            }
        });
        txtaddport.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtaddportActionPerformed(evt);
            }
        });

        TbPort.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        TbPort.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        TbPort.setSelectionBackground(new java.awt.Color(170, 0, 0));
        TbPort.setSelectionForeground(new java.awt.Color(0, 0, 0));
        TbPort.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TbPortMouseClicked(evt);
            }
        });
        jScrollPane6.setViewportView(TbPort);

        jLabel16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Button White Add.png"))); // NOI18N
        jLabel16.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabel16MouseClicked(evt);
            }
        });

        txtportamount.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                txtportamountMouseClicked(evt);
            }
        });
        txtportamount.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtportamountActionPerformed(evt);
            }
        });

        jLabel21.setText("Amount :");

        javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
        jPanel13.setLayout(jPanel13Layout);
        jPanel13Layout.setHorizontalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 1310, Short.MAX_VALUE)
                    .addGroup(jPanel13Layout.createSequentialGroup()
                        .addComponent(jLabel15)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtaddport, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel21)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtportamount, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel13Layout.setVerticalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel13Layout.createSequentialGroup()
                        .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel15)
                            .addComponent(txtaddport, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtportamount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel21))
                        .addGap(23, 23, 23))
                    .addGroup(jPanel13Layout.createSequentialGroup()
                        .addComponent(jLabel16)
                        .addGap(18, 18, 18)))
                .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 597, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Portfolio", new javax.swing.ImageIcon(getClass().getResource("/images/Add-icon.png")), jPanel13); // NOI18N

        TbGroup.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        TbGroup.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        TbGroup.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION);
        TbGroup.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TbGroupMouseClicked(evt);
            }
        });
        jScrollPane5.setViewportView(TbGroup);

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 1310, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 647, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Group&category", new javax.swing.ImageIcon(getClass().getResource("/images/group_pic.png")), jPanel12); // NOI18N

        jPanel16.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        lbranktype.setText("RankType");

        cbranktype.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "---------------------------", "รวม", "ปริมาณซื้อขาย 20 อันดับ", "ราคาเพิ่มขึ้น 20 อันดับ", "ราคาลดลง 20 อันดับ" }));
        cbranktype.setToolTipText("");
        cbranktype.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cbranktypeItemStateChanged(evt);
            }
        });

        lbranking.setText("  ");

        javax.swing.GroupLayout jPanel16Layout = new javax.swing.GroupLayout(jPanel16);
        jPanel16.setLayout(jPanel16Layout);
        jPanel16Layout.setHorizontalGroup(
            jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel16Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lbranktype)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(cbranktype, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lbranking, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(969, Short.MAX_VALUE))
        );
        jPanel16Layout.setVerticalGroup(
            jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel16Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbranktype)
                    .addComponent(cbranktype, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbranking))
                .addContainerGap(13, Short.MAX_VALUE))
        );

        TbRank.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        TbRank.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        jScrollPane9.setViewportView(TbRank);

        javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15);
        jPanel15.setLayout(jPanel15Layout);
        jPanel15Layout.setHorizontalGroup(
            jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel15Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel16, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPane9, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 1310, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel15Layout.setVerticalGroup(
            jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel15Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane9, javax.swing.GroupLayout.DEFAULT_SIZE, 592, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Ranking", new javax.swing.ImageIcon(getClass().getResource("/images/chart_up_color.png")), jPanel15); // NOI18N

        jToolBar1.setRollover(true);
        jToolBar1.setToolTipText("");
        jToolBar1.setBorderPainted(false);
        jToolBar1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jToolBar1.setEnabled(false);

        jLabel17.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/IP.png"))); // NOI18N
        jLabel17.setText(" ");
        jToolBar1.add(jLabel17);

        IPHostName.setText("Loading... ");
        jToolBar1.add(IPHostName);
        jToolBar1.add(jSeparator1);

        lbtime.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/clock.png"))); // NOI18N
        lbtime.setText(" ");
        jToolBar1.add(lbtime);

        lbtxttime.setText("Loading...");
        jToolBar1.add(lbtxttime);
        jToolBar1.add(jSeparator2);

        jLabel3.setText("สถานะดัชนี : ");
        jToolBar1.add(jLabel3);

        jLabel2.setText("..");
        jToolBar1.add(jLabel2);
        jToolBar1.add(jSeparator3);

        jLabel18.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/update.png"))); // NOI18N
        jLabel18.setText(" ");
        jToolBar1.add(jLabel18);

        jProgressBar1.setMaximumSize(new java.awt.Dimension(50, 14));
        jProgressBar1.setString("25%");
        jProgressBar1.setStringPainted(true);
        jToolBar1.add(jProgressBar1);

        jLabel19.setText("  Complete On :");
        jToolBar1.add(jLabel19);

        jLabel20.setText("...........");
        jToolBar1.add(jLabel20);

        jPanel9.setBackground(new java.awt.Color(0, 0, 0));

        jPanel2.setBackground(new java.awt.Color(0, 0, 0));

        index.setBackground(new java.awt.Color(51, 51, 51));
        index.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        index.setForeground(new java.awt.Color(255, 255, 0));
        index.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        index.setText("SET");

        Now.setBackground(new java.awt.Color(0, 0, 0));
        Now.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        Now.setForeground(new java.awt.Color(255, 0, 51));
        Now.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        lbmkv.setBackground(new java.awt.Color(51, 51, 51));
        lbmkv.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lbmkv.setForeground(new java.awt.Color(255, 255, 0));
        lbmkv.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        lbmkv.setText("Mkt.Val");

        MkV.setBackground(new java.awt.Color(0, 0, 0));
        MkV.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        MkV.setForeground(new java.awt.Color(255, 255, 255));
        MkV.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        lbhigh.setBackground(new java.awt.Color(51, 51, 51));
        lbhigh.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lbhigh.setForeground(new java.awt.Color(255, 255, 0));
        lbhigh.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        lbhigh.setText("High");

        lw.setBackground(new java.awt.Color(0, 0, 0));
        lw.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lw.setForeground(new java.awt.Color(255, 0, 51));
        lw.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        hg.setBackground(new java.awt.Color(0, 0, 0));
        hg.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        hg.setForeground(new java.awt.Color(153, 204, 0));
        hg.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        lblow.setBackground(new java.awt.Color(51, 51, 51));
        lblow.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblow.setForeground(new java.awt.Color(255, 255, 0));
        lblow.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        lblow.setText("Low");

        lbchange.setBackground(new java.awt.Color(51, 51, 51));
        lbchange.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lbchange.setForeground(new java.awt.Color(255, 255, 0));
        lbchange.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        lbchange.setText("Chg");

        txtchg.setBackground(new java.awt.Color(0, 0, 0));
        txtchg.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        txtchg.setForeground(new java.awt.Color(153, 204, 0));
        txtchg.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        lbpchg.setBackground(new java.awt.Color(51, 51, 51));
        lbpchg.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lbpchg.setForeground(new java.awt.Color(255, 255, 0));
        lbpchg.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        lbpchg.setText("%Chg");

        txtpchg.setBackground(new java.awt.Color(0, 0, 0));
        txtpchg.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        txtpchg.setForeground(new java.awt.Color(255, 255, 0));
        txtpchg.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        lbvol.setBackground(new java.awt.Color(51, 51, 51));
        lbvol.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lbvol.setForeground(new java.awt.Color(255, 255, 0));
        lbvol.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        lbvol.setText("Vol");

        txtvol.setBackground(new java.awt.Color(0, 0, 0));
        txtvol.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        txtvol.setForeground(new java.awt.Color(255, 255, 255));
        txtvol.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        lbstatus.setBackground(new java.awt.Color(51, 51, 51));
        lbstatus.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lbstatus.setForeground(new java.awt.Color(255, 255, 0));
        lbstatus.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        lbstatus.setText("Status");

        txtstatus.setBackground(new java.awt.Color(0, 0, 0));
        txtstatus.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        txtstatus.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        txttime.setBackground(new java.awt.Color(0, 0, 0));
        txttime.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        txttime.setForeground(new java.awt.Color(255, 255, 0));
        txttime.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        lbtime1.setBackground(new java.awt.Color(51, 51, 51));
        lbtime1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lbtime1.setForeground(new java.awt.Color(255, 255, 0));
        lbtime1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        lbtime1.setText("Time ");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(index, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(Now, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lbmkv, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(MkV, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbhigh, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(hg, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblow, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lw, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbchange, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtchg, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbpchg, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtpchg, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbvol, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtvol, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbstatus, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtstatus, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbtime1, javax.swing.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txttime, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(15, 15, 15))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(index, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(Now, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbmkv, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(MkV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbhigh, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(hg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lw, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbchange, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtchg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbpchg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtpchg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbvol, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtvol, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbstatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtstatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txttime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbtime1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 1307, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addComponent(jPanel9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jTabbedPane1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(2, 2, 2)
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
//IPHostName.setText("IP : "+new IPAdress().getMyPublicIP());
}//GEN-LAST:event_formWindowActivated

private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
//new Thread(new Runnable() {
//
//            @Override
//            public void run() {
//                try {
//           
//                stringList = new ArrayList();
//                stringList1= new ArrayList();
//                stringList2 = new ArrayList();
//               // jComboBox1.removeAllItems();
//            connect con=new connect();
//            con.rs=con.stmt.executeQuery("SELECT * FROM `stock_feed` ORDER BY `stock_feed`.`id` ASC ");
//            int a=0;
//            while(con.rs.next()){
//                stringList.add(a, con.rs.getString(1));
//                stringList1.add(a, con.rs.getString(2));
//              stringList2.add(a, con.rs.getString(3));
//           //   jComboBox1.addItem(stringList1.get(a)); 
//              a++;
//              
//            }
//        } catch (SQLException ex) {
//            Logger.getLogger(STOCK.class.getName()).log(Level.SEVERE, null, ex);
//        }
//            }
//        }).start();      

       // GETThread gETThread = new GETThread();
      //gETThread.show();
}//GEN-LAST:event_formWindowOpened

private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
 java.awt.Toolkit.getDefaultToolkit()
                    .setLockingKeyState(KeyEvent.VK_CAPS_LOCK, false);//jarStarter();
// TODO add your handling code here:
}//GEN-LAST:event_formWindowClosing

private void formComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentResized

}//GEN-LAST:event_formComponentResized

private void TbNewsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TbNewsMouseClicked
    
    
  
}//GEN-LAST:event_TbNewsMouseClicked



private void TbNewsMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TbNewsMouseReleased
if(SwingUtilities.isRightMouseButton(evt)){
			Point p = evt.getPoint();	
			int rowNumber = TbNews.rowAtPoint( p );	
			ListSelectionModel model = TbNews.getSelectionModel();
			model.setSelectionInterval( rowNumber, rowNumber );
                        popupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
}
  
}//GEN-LAST:event_TbNewsMouseReleased

private void btSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSearchActionPerformed
t8.suspend(); 
txtNewSearch();
}//GEN-LAST:event_btSearchActionPerformed

public void txtNewSearch(){
    /////////////////////Start SETINDEX///////////////////////////////////////////
 
       String[] Col1 = {"วันที่และเวลา","ชื่อบริษัท","เรื่อง"};
    //  TabNews.stop();
          try {
            DefaultTableModel model=new DefaultTableModel(Col1,0);
        


            connect dbcon=new connect();
        
             connect dbcon1=new connect();
           String sqlsec = null;
          if(cbSearch.getSelectedIndex()==0){
             sqlsec="SELECT * FROM `stock_news` Where (DateTime LIKE '"+txtSearch.getText()+"%' ) Order By DateTime Desc ";
                      System.out.println(sqlsec);
          }else if(cbSearch.getSelectedIndex()==1){
               sqlsec="SELECT * FROM `stock_news` Where (Company LIKE '"+txtSearch.getText()+"%' ) Order By DateTime Desc";
                System.out.println(sqlsec);
          }else if(cbSearch.getSelectedIndex()==2){
               sqlsec="SELECT * FROM `stock_news` Where (Title LIKE '%"+txtSearch.getText()+"%' ) Order By DateTime Desc";
                System.out.println(sqlsec);
          }
          else if(cbSearch.getSelectedIndex()==3){
               sqlsec="SELECT * FROM `stock_news` Where (Company LIKE '%"+txtSearch.getText()+"%' ) Order By DateTime Desc";
                System.out.println(sqlsec);
          }
          
            if(sqlsec != null){
                 dbcon1.rs= dbcon1.stmt.executeQuery(sqlsec);
             while(dbcon1.rs.next()){
                 String x[]={dbcon1.rs.getString(2),dbcon1.rs.getString(3),dbcon1.rs.getString(4)}; 
       
                // System.err.println(dbcon.rs.getString(2)+dbcon.rs.getString(3)+dbcon.rs.getString(4));
                 model.addRow(x);
             } 
       
            
            }
           
          
           STOCK.TbNews.setModel(model);
          dbcon1.CloseDB();
               
             
        } catch (SQLException ex) {
            ex.printStackTrace();
            
        }
      
        TbNews.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
      TbNews.getColumnModel().getColumn(0).setResizable(false);
       TbNews.getColumnModel().getColumn(0).setPreferredWidth(100);
        TbNews.getColumnModel().getColumn(1).setResizable(false);
       TbNews.getColumnModel().getColumn(1).setPreferredWidth(80);
       TbNews.getColumnModel().getColumn(2).setResizable(true);
       TbNews.getColumnModel().getColumn(2).setPreferredWidth(800);   
        
        
/////////////////////End SETINDEX///////////////////////////////////////////// TODO add your handling code here:
}


private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
      txtSearch.setText("");
      t8.resume();
    /////////////////////Start SETINDEX///////////////////////////////////////////
    
   //   TabNews= new javax.swing.Timer(5005, new NewsTbListener());
   //    TabNews.start();
   
/////////////////////End SETINDEX///////////////////////////////////////////// TODO add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed

private void txtSearchMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtSearchMouseClicked
java.awt.Toolkit.getDefaultToolkit()
                    .setLockingKeyState(KeyEvent.VK_CAPS_LOCK, false);
    if(SwingUtilities.isRightMouseButton(evt)){
			
                        txtSearchpopupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
}
}//GEN-LAST:event_txtSearchMouseClicked
String DelTbAlert[]=new String[3];
String DelTbFavorite[]=new String[1];
String DelTbport[]=new String[1];

 

private void TbAlertMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TbAlertMouseClicked

    if(SwingUtilities.isRightMouseButton(evt)){
        if(TbAlert.getRowCount()<=0){
             
              AlertpopupMenu.show(evt.getComponent(), evt.getXOnScreen(), evt.getYOnScreen());
        }else{
			 Point p = evt.getPoint();	
	int rowNumber = TbAlert.rowAtPoint( p );	
        int colNumber = TbAlert.columnAtPoint( p );
			ListSelectionModel model = TbAlert.getSelectionModel();
		model.setSelectionInterval( rowNumber, rowNumber );
                  AlertpopupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
               //   System.out.println(TbAlert.getSelectedRow());
                         DelTbAlert[0]=TbAlert.getValueAt(rowNumber,0 ).toString();
                         DelTbAlert[1]=TbAlert.getValueAt(rowNumber,1 ) .toString();
                          DelTbAlert[2]=TbAlert.getValueAt(rowNumber,2 ).toString();
                      
        }                 
}
 
}//GEN-LAST:event_TbAlertMouseClicked

private void jTabbedPane1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTabbedPane1MouseClicked
new AddAlert().GetAlert();
}//GEN-LAST:event_jTabbedPane1MouseClicked

private void txtSymbolActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtSymbolActionPerformed

}//GEN-LAST:event_txtSymbolActionPerformed

private void txtSymbolKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtSymbolKeyPressed
/*if(evt.getKeyCode()==10){
Keypress=0;
if(Keypress==0){
   String txtsearch=txtSymbol.getText();
        
ST_name SN=new ST_name();
  if(Arrays.binarySearch(ST_name.st,txtsearch.toUpperCase())>=0 ){
      javax.swing.JOptionPane.showMessageDialog(this,"Found Symbol "+txtsearch);
      txtvalues.setEnabled(true);
              lbFilePath.setEnabled(true);
              btBrowser.setEnabled(true);
                      btaddalert.setEnabled(true);
    }else{
         javax.swing.JOptionPane.showMessageDialog(this,"Not Found Symbol "+txtsearch);
    } 
}else{
     txtvalues.setEnabled(false);
              lbFilePath.setEnabled(false);
              btBrowser.setEnabled(false);
                      btaddalert.setEnabled(false);
}

  

}*/

 /*   String txtsearch=txtSymbol.getText();
    ST_name SN=new ST_name();
  if(Arrays.binarySearch(ST_name.st,txtsearch.toUpperCase())>=0 ){
   //   javax.swing.JOptionPane.showMessageDialog(this,"Found Symbol "+txtsearch);
      txtvalues.setEnabled(true);
              lbFilePath.setEnabled(true);
              btBrowser.setEnabled(true);
                      btaddalert.setEnabled(true);
    }else{
       Keypress=1; 
   txtvalues.setEnabled(false);
              lbFilePath.setEnabled(false);
              btBrowser.setEnabled(false);
                      btaddalert.setEnabled(false);
        // javax.swing.JOptionPane.showMessageDialog(this,"Not Found Symbol "+txtsearch);
    

}*/
}//GEN-LAST:event_txtSymbolKeyPressed
 
private void txtSymbolKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtSymbolKeyTyped
   String txtsearch=txtSymbol.getText();
     // System.out.println(txtsearch);
    ST_name SN=new ST_name();
    int as=Arrays.binarySearch(ST_name.st,txtsearch.toUpperCase());
    
  if(as>=0 ){
      System.out.println(as);
   //   javax.swing.JOptionPane.showMessageDialog(this,"Found Symbol "+txtsearch);
                txtvalues.setEnabled(true);
              txtvalues1.setEnabled(true);
              lbFilePath.setEnabled(true);
              btBrowser.setEnabled(true);
                      btaddalert.setEnabled(true);
      t6.resume();
       lbSymbol2.setText("waiting");
lbvalue2.setText("waiting");  
    }else{
      System.out.println(as);
       Keypress=1; 
   txtvalues.setEnabled(false);
   txtvalues1.setEnabled(false);
              lbFilePath.setEnabled(false);
              btBrowser.setEnabled(false);
                      btaddalert.setEnabled(false);
        // javax.swing.JOptionPane.showMessageDialog(this,"Not Found Symbol "+txtsearch);
  
  t6.suspend();
lbSymbol2.setText("..");
lbvalue2.setText("..");

}
}//GEN-LAST:event_txtSymbolKeyTyped

private void btBrowserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btBrowserActionPerformed
Fc Fc=new Fc(null,true);
Fc.show();// TODO add your handling code here:
lbFilePath.setText(Fc.FilePath);
}//GEN-LAST:event_btBrowserActionPerformed

private void TbPortMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TbPortMouseClicked
if(SwingUtilities.isRightMouseButton(evt)){
        if(TbPort.getRowCount()<=0){
             
              PortpopupMenu.show(evt.getComponent(), evt.getXOnScreen(), evt.getYOnScreen());
        }else{
			 Point p = evt.getPoint();	
	int rowNumber = TbPort.rowAtPoint( p );	
        int colNumber = TbPort.columnAtPoint( p );
			ListSelectionModel model = TbPort.getSelectionModel();
		model.setSelectionInterval( rowNumber, rowNumber );
                  PortpopupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
               
                         DelTbport[0]=TbPort.getValueAt(rowNumber,0 ).toString();
                      System.out.println(DelTbport[0]);
                      
        }                 
}
}//GEN-LAST:event_TbPortMouseClicked

private void jLabel16MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel16MouseClicked
if(SwingUtilities.isLeftMouseButton(evt)){
    
    Addport Addport=new Addport(txtaddport,txtportamount);
    Addport.addport();
    
}

}//GEN-LAST:event_jLabel16MouseClicked

private void btaddalertMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btaddalertMouseClicked
 if(SwingUtilities.isLeftMouseButton(evt)){
try {
    if((((!txtSymbol.getText().equals("")&&!txtvalues.getText().equals(""))&&!txtvalues1.getText().equals(""))&&(!lbFilePath.getText().equals("..")||!lbFilePath.getText().equals("")))){
             int reply =   javax.swing.JOptionPane.showConfirmDialog(null,"Do you want to add alert for "+txtSymbol.getText().toUpperCase()+" low="+txtvalues.getText()+"  up="+txtvalues1.getText()+" ?","Add Alert",JOptionPane.YES_NO_OPTION);
             if(reply == JOptionPane.YES_OPTION){
                 
            
            String Path="";String PathCon="";
            connect dbcon=new connect(); 
            
                        if((lbFilePath.getText().equals("..")||lbFilePath.getText().equals(""))){
                            Fc Fc=new Fc(null,true);
                            Fc.show();// TODO add your handling code here:
                          
                       
                           Path=lbFilePath.getText(); 
                           PathCon= Path.substring(6, Path.length());
                         }else{
                           Path=lbFilePath.getText(); 
                           PathCon= Path.substring(6, Path.length());
                           
                        }
                        
                 
                      String    sqlsec="INSERT INTO `stock_ alert` (`stockname` ,`value` ,`soundtype` ,`value1`,state)VALUES ('"+txtSymbol.getText().toUpperCase()+"', '"+txtvalues.getText()+"', '"+PathCon+"', '"+txtvalues1.getText()+"','1');";
                     if(!txtSymbol.getText().equals("")&&!txtvalues.getText().equals("")){
                        
                      int rs= dbcon.stmt.executeUpdate(sqlsec);
                     }
                       dbcon.CloseDB();
                       
                       }
            //  this.dispose();
    }
        } catch (SQLException ex) {
        }
        
        
        
        
        
        txtSymbol.setText("");
        txtvalues.setText("");
        txtvalues1.setText("");
        lbvalue2.setText("");
        lbFilePath.setText("..");
        lbSymbol2.setText("");
    new AddAlert().GetAlert();
   

        
        
 }
         
        
        // TODO add your handling code here:
}//GEN-LAST:event_btaddalertMouseClicked

private void btviewMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btviewMouseClicked
   /////////////////////ViewStock///////////////////////////////////////////
   if(SwingUtilities.isLeftMouseButton(evt)){
       
        
         t11.start(); 
         t19.start();
    
    txtSymbol3.setEnabled(false);
    txtwaiting.setEnabled(false);
    txtwaiting.setText("Waiting");
    btview.setEnabled(false);
 //  JL.setText("Waiting");
 
 // if(t11.isAlive()){
 //     t11.destroy();
 // }
  //t11.start();
    //    System.out.println(t11.isDaemon());
 //   System.out.println(t11.isAlive());
   ///  t11.start();
    //     System.out.println(t11.isDaemon());
   // System.out.println(t11.isAlive());
   }
}//GEN-LAST:event_btviewMouseClicked

private void txtSymbol3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtSymbol3MouseClicked
 java.awt.Toolkit.getDefaultToolkit()
                    .setLockingKeyState(KeyEvent.VK_CAPS_LOCK, true);
 if(!txtSymbol3.isEnabled()){
    if(!t11.isAlive()){
    t11.stop();
    t19.stop();
}
txtSymbol3.setText("");
txtSymbol3.setEnabled(true);
btview.setEnabled(true);
txtwaiting.setText("");
txtGroup.setText("");
 }
}//GEN-LAST:event_txtSymbol3MouseClicked

private void txtSymbol3KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtSymbol3KeyTyped


}//GEN-LAST:event_txtSymbol3KeyTyped

private void txtSymbol3MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtSymbol3MouseExited
// TODO add your handling code here:
}//GEN-LAST:event_txtSymbol3MouseExited

private void jLabel13MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel13MouseClicked
if(SwingUtilities.isLeftMouseButton(evt)){
try {
             int reply =   javax.swing.JOptionPane.showConfirmDialog(null,"You want add favorite for "+txtfavorite.getText().toUpperCase()+"?","Add Favorite",JOptionPane.YES_NO_OPTION);
           System.out.println(reply);
           
             if(reply == 0){
                 
            
          
            connect dbcon=new connect(); 
                     String sql=" SELECT count(*) FROM `stock_favorite` where SymbolName='"+txtfavorite.getText().toUpperCase()+"'";
                        dbcon.rs=dbcon.stmt.executeQuery(sql);
                        dbcon.rs.next();
                        System.out.println(sql);
                  //      javax.swing.JOptionPane.showMessageDialog(null, sql);
                        if(Integer.parseInt(dbcon.rs.getString(1))<=0){
                      String    sqlsec="INSERT INTO `stock_favorite` (`SymbolName`)VALUES ('"+txtfavorite.getText().toUpperCase()+"');";
                     System.out.println(sqlsec);
                      if(!txtfavorite.getText().equals("")){
                        
                      dbcon.stmt.executeUpdate(sqlsec);
                     }
                       dbcon.CloseDB();///////////
                       
                       }}
            //  this.dispose();
        } catch (SQLException ex) {
        }
        
        
        
        
        
        txtfavorite.setText("");
 
        
  new ReadFavoriteDetail().GetAlert();
 //  

        
        
 }
         
        
}//GEN-LAST:event_jLabel13MouseClicked

private void cbranktypeItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbranktypeItemStateChanged
if(cbranktype.getSelectedIndex()>0){
       STOCK.cbranktype.setEnabled(false);
    if(!t15.isAlive()){
       t15.suspend();
    }else{
        t15.resume();
    }
    
}else{
    
    TbRank.setModel(new javax.swing.table.DefaultTableModel(
    new Object [][] {

    },
    new String [] {

    }
));
}
}//GEN-LAST:event_cbranktypeItemStateChanged
int InFramecount=0;
private void btChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btChartActionPerformed
 //System.out.println(InFramecount%2);
    if(ChartLine.isVisible()==true){
      
     ChartCandle.removeAll();
    ChartLine.removeAll();

    try {
            Dimension size = ChartLine.getSize();
                   LineChart LC=  new LineChart(size,txtsymbol,txtinterval,cbAnalysis);  
                        LC.setVisible(true);
                        LC.setEnabled(false);
                        ChartLine.add(LC);
                           Dimension size1 = ChartCandle.getSize();
                        candlestickChart LC1=  new candlestickChart(size1,txtsymbol,txtinterval,cbAnalysis);  
                        LC1.setVisible(true);
                        LC1.setEnabled(false);
                        ChartCandle.add(LC1);// TODO add your handling code here:
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
               ++InFramecount; 
             
      }  else{

   
      ++InFramecount; 
}
      
         
}//GEN-LAST:event_btChartActionPerformed

private void txtsymbolKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtsymbolKeyPressed
if(evt.getKeyCode()==10){
   // txtsymbol.setEnabled(false);
     GS=new GetSymbolServer(txtsymbol,txtwating,btChart);
    GS.GetSymbol();
       
    
     
       
   
    
}
}//GEN-LAST:event_txtsymbolKeyPressed

private void txtsymbolMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtsymbolMouseClicked
java.awt.Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent.VK_CAPS_LOCK, true);
      
//Font font = new Font("Tahoma", Font.BOLD, 12);
//txtsymbol.setFont(font);
//txtsymbol.setForeground(Color.GREEN);
 
//txtsymbol.setText("");
txtwating.setText("");

}//GEN-LAST:event_txtsymbolMouseClicked

private void txtSymbolMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtSymbolMouseClicked
java.awt.Toolkit.getDefaultToolkit()
                    .setLockingKeyState(KeyEvent.VK_CAPS_LOCK, true);// TODO add your handling code here:
}//GEN-LAST:event_txtSymbolMouseClicked

private void txtaddportMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtaddportMouseClicked
java.awt.Toolkit.getDefaultToolkit()
                    .setLockingKeyState(KeyEvent.VK_CAPS_LOCK, true);// TODO add your handling code here:
}//GEN-LAST:event_txtaddportMouseClicked

private void txtfavoriteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtfavoriteMouseClicked
java.awt.Toolkit.getDefaultToolkit()
                    .setLockingKeyState(KeyEvent.VK_CAPS_LOCK, true);// TODO add your handling code here:
}//GEN-LAST:event_txtfavoriteMouseClicked

private void CbOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CbOpenActionPerformed
     if(ChartLine.isVisible()==true){
            
    ChartCandle.removeAll();
    ChartLine.removeAll();
    ChartCDMA.removeAll();
    ChartRSI.removeAll();
    try {
            Dimension size = ChartLine.getSize();
                   LineChart LC=  new LineChart(size,txtsymbol,txtinterval,cbAnalysis);  
                        LC.setVisible(true);
                        LC.setEnabled(false);
                        ChartLine.add(LC);
                        
                           Dimension size1 = ChartCandle.getSize();
                        candlestickChart LC1=  new candlestickChart(size1,txtsymbol,txtinterval,cbAnalysis);  
                        LC1.setVisible(true);
                        LC1.setEnabled(false);
                        ChartCandle.add(LC1);
                        
                        Dimension size2 = ChartCDMA.getSize();
                        CDMAChart LC2=  new CDMAChart(size2,txtsymbol,txtinterval,cbAnalysis);  
                        LC2.setVisible(true);
                        LC2.setEnabled(false);
                        ChartCDMA.add(LC2);
                        
                          Dimension size3 = ChartRSI.getSize();
                        RSIChart LC3=  new RSIChart(size3,txtsymbol,txtinterval,cbAnalysis);  
                        LC3.setVisible(true);
                        LC3.setEnabled(false);
                        ChartRSI.add(LC3);
                        
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
               ++InFramecount; 
             
      }
}//GEN-LAST:event_CbOpenActionPerformed

private void CbHighActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CbHighActionPerformed
      if(ChartLine.isVisible()==true){
            
    ChartCandle.removeAll();
    ChartLine.removeAll();
    ChartCDMA.removeAll();
    ChartRSI.removeAll();
    try {
            Dimension size = ChartLine.getSize();
                   LineChart LC=  new LineChart(size,txtsymbol,txtinterval,cbAnalysis);  
                        LC.setVisible(true);
                        LC.setEnabled(false);
                        ChartLine.add(LC);
                        
                           Dimension size1 = ChartCandle.getSize();
                        candlestickChart LC1=  new candlestickChart(size1,txtsymbol,txtinterval,cbAnalysis);  
                        LC1.setVisible(true);
                        LC1.setEnabled(false);
                        ChartCandle.add(LC1);
                        
                        Dimension size2 = ChartCDMA.getSize();
                        CDMAChart LC2=  new CDMAChart(size2,txtsymbol,txtinterval,cbAnalysis);  
                        LC2.setVisible(true);
                        LC2.setEnabled(false);
                        ChartCDMA.add(LC2);
                        
                          Dimension size3 = ChartRSI.getSize();
                        RSIChart LC3=  new RSIChart(size3,txtsymbol,txtinterval,cbAnalysis);  
                        LC3.setVisible(true);
                        LC3.setEnabled(false);
                        ChartRSI.add(LC3);
                        
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
               ++InFramecount; 
             
      }
}//GEN-LAST:event_CbHighActionPerformed

private void CbLowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CbLowActionPerformed
      if(ChartLine.isVisible()==true){
            
    ChartCandle.removeAll();
    ChartLine.removeAll();
    ChartCDMA.removeAll();
    ChartRSI.removeAll();
    try {
            Dimension size = ChartLine.getSize();
                   LineChart LC=  new LineChart(size,txtsymbol,txtinterval,cbAnalysis);  
                        LC.setVisible(true);
                        LC.setEnabled(false);
                        ChartLine.add(LC);
                        
                           Dimension size1 = ChartCandle.getSize();
                        candlestickChart LC1=  new candlestickChart(size1,txtsymbol,txtinterval,cbAnalysis);  
                        LC1.setVisible(true);
                        LC1.setEnabled(false);
                        ChartCandle.add(LC1);
                        
                        Dimension size2 = ChartCDMA.getSize();
                        CDMAChart LC2=  new CDMAChart(size2,txtsymbol,txtinterval,cbAnalysis);  
                        LC2.setVisible(true);
                        LC2.setEnabled(false);
                        ChartCDMA.add(LC2);
                        
                          Dimension size3 = ChartRSI.getSize();
                        RSIChart LC3=  new RSIChart(size3,txtsymbol,txtinterval,cbAnalysis);  
                        LC3.setVisible(true);
                        LC3.setEnabled(false);
                        ChartRSI.add(LC3);
                        
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
               ++InFramecount; 
             
      }
}//GEN-LAST:event_CbLowActionPerformed

private void CbCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CbCloseActionPerformed
      if(ChartLine.isVisible()==true){
            
    ChartCandle.removeAll();
    ChartLine.removeAll();
    ChartCDMA.removeAll();
    ChartRSI.removeAll();
    try {
            Dimension size = ChartLine.getSize();
                   LineChart LC=  new LineChart(size,txtsymbol,txtinterval,cbAnalysis);  
                        LC.setVisible(true);
                        LC.setEnabled(false);
                        ChartLine.add(LC);
                        
                           Dimension size1 = ChartCandle.getSize();
                        candlestickChart LC1=  new candlestickChart(size1,txtsymbol,txtinterval,cbAnalysis);  
                        LC1.setVisible(true);
                        LC1.setEnabled(false);
                        ChartCandle.add(LC1);
                        
                        Dimension size2 = ChartCDMA.getSize();
                        CDMAChart LC2=  new CDMAChart(size2,txtsymbol,txtinterval,cbAnalysis);  
                        LC2.setVisible(true);
                        LC2.setEnabled(false);
                        ChartCDMA.add(LC2);
                        
                          Dimension size3 = ChartRSI.getSize();
                        RSIChart LC3=  new RSIChart(size3,txtsymbol,txtinterval,cbAnalysis);  
                        LC3.setVisible(true);
                        LC3.setEnabled(false);
                        ChartRSI.add(LC3);
                        
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
               ++InFramecount; 
             
      }
}//GEN-LAST:event_CbCloseActionPerformed
public static int AEMA;
private void CbEMAActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CbEMAActionPerformed
  if(EMAPeriod.equals("")){
            EMAPeriod=javax.swing.JOptionPane.showInputDialog(null,"Enter Period","9,14");
           }else{
    EMAPeriod="";  
  }
     if(ChartLine.isVisible()==true){
            
    ChartCandle.removeAll();
    ChartLine.removeAll();
    ChartCDMA.removeAll();
    ChartRSI.removeAll();
    try {
            Dimension size = ChartLine.getSize();
                   LineChart LC=  new LineChart(size,txtsymbol,txtinterval,cbAnalysis);  
                        LC.setVisible(true);
                        LC.setEnabled(false);
                        ChartLine.add(LC);
                        
                           Dimension size1 = ChartCandle.getSize();
                        candlestickChart LC1=  new candlestickChart(size1,txtsymbol,txtinterval,cbAnalysis);  
                        LC1.setVisible(true);
                        LC1.setEnabled(false);
                        ChartCandle.add(LC1);
                        
                        Dimension size2 = ChartCDMA.getSize();
                        CDMAChart LC2=  new CDMAChart(size2,txtsymbol,txtinterval,cbAnalysis);  
                        LC2.setVisible(true);
                        LC2.setEnabled(false);
                        ChartCDMA.add(LC2);
                        
                          Dimension size3 = ChartRSI.getSize();
                        RSIChart LC3=  new RSIChart(size3,txtsymbol,txtinterval,cbAnalysis);  
                        LC3.setVisible(true);
                        LC3.setEnabled(false);
                        ChartRSI.add(LC3);
                        
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
               ++InFramecount; 
             
      }
}//GEN-LAST:event_CbEMAActionPerformed

private void CbSMAActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CbSMAActionPerformed
if(SMAPeriod.equals("")){
            SMAPeriod=javax.swing.JOptionPane.showInputDialog(null,"Enter Period","15,50");
           }else{
    SMAPeriod="";  
  }
      if(ChartLine.isVisible()==true){
            
    ChartCandle.removeAll();
    ChartLine.removeAll();
    ChartCDMA.removeAll();
    ChartRSI.removeAll();
    try {
            Dimension size = ChartLine.getSize();
                   LineChart LC=  new LineChart(size,txtsymbol,txtinterval,cbAnalysis);  
                        LC.setVisible(true);
                        LC.setEnabled(false);
                        ChartLine.add(LC);
                        
                           Dimension size1 = ChartCandle.getSize();
                        candlestickChart LC1=  new candlestickChart(size1,txtsymbol,txtinterval,cbAnalysis);  
                        LC1.setVisible(true);
                        LC1.setEnabled(false);
                        ChartCandle.add(LC1);
                        
                        Dimension size2 = ChartCDMA.getSize();
                        CDMAChart LC2=  new CDMAChart(size2,txtsymbol,txtinterval,cbAnalysis);  
                        LC2.setVisible(true);
                        LC2.setEnabled(false);
                        ChartCDMA.add(LC2);
                        
                          Dimension size3 = ChartRSI.getSize();
                        RSIChart LC3=  new RSIChart(size3,txtsymbol,txtinterval,cbAnalysis);  
                        LC3.setVisible(true);
                        LC3.setEnabled(false);
                        ChartRSI.add(LC3);
                        
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
               ++InFramecount; 
             
      }
}//GEN-LAST:event_CbSMAActionPerformed

private void jCheckBox7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox7ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jCheckBox7ActionPerformed

private void CbWMAActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CbWMAActionPerformed
if(WMAPeriod.equals("")){
            WMAPeriod=javax.swing.JOptionPane.showInputDialog(null,"Enter Period","10,25,75");
           }else{
    WMAPeriod="";  
  }
        if(ChartLine.isVisible()==true){
            
    ChartCandle.removeAll();
    ChartLine.removeAll();
    ChartCDMA.removeAll();
    ChartRSI.removeAll();
    try {
            Dimension size = ChartLine.getSize();
                   LineChart LC=  new LineChart(size,txtsymbol,txtinterval,cbAnalysis);  
                        LC.setVisible(true);
                        LC.setEnabled(false);
                        ChartLine.add(LC);
                        
                           Dimension size1 = ChartCandle.getSize();
                        candlestickChart LC1=  new candlestickChart(size1,txtsymbol,txtinterval,cbAnalysis);  
                        LC1.setVisible(true);
                        LC1.setEnabled(false);
                        ChartCandle.add(LC1);
                        
                        Dimension size2 = ChartCDMA.getSize();
                        CDMAChart LC2=  new CDMAChart(size2,txtsymbol,txtinterval,cbAnalysis);  
                        LC2.setVisible(true);
                        LC2.setEnabled(false);
                        ChartCDMA.add(LC2);
                        
                          Dimension size3 = ChartRSI.getSize();
                        RSIChart LC3=  new RSIChart(size3,txtsymbol,txtinterval,cbAnalysis);  
                        LC3.setVisible(true);
                        LC3.setEnabled(false);
                        ChartRSI.add(LC3);
                        
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
               ++InFramecount; 
             
      }
}//GEN-LAST:event_CbWMAActionPerformed

private void ChartLineMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ChartLineMouseClicked
if(SwingUtilities.isRightMouseButton(evt)){
			Point p = evt.getPoint();	
			int rowNumber = TbNews.rowAtPoint( p );	
			ListSelectionModel model = TbNews.getSelectionModel();
			model.setSelectionInterval( rowNumber, rowNumber );
                        popupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
}
}//GEN-LAST:event_ChartLineMouseClicked

private void EXCandleStickActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EXCandleStickActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_EXCandleStickActionPerformed

private void EXLineChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EXLineChartActionPerformed
if(EXLineChart.isSelected()){
  FramePk.main(new String[]{"0"});// FPK=new FramePk().m;
 
}
}//GEN-LAST:event_EXLineChartActionPerformed

private void EXMACDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EXMACDActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_EXMACDActionPerformed

private void EXRSIActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EXRSIActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_EXRSIActionPerformed

private void txtSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtSearchActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtSearchActionPerformed

private void cbSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbSearchActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_cbSearchActionPerformed

private void txtaddportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtaddportActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtaddportActionPerformed

private void TbFavoriteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TbFavoriteMouseClicked
 if(SwingUtilities.isRightMouseButton(evt)){
        if(TbFavorite.getRowCount()<=0){
             
              FapopupMenu.show(evt.getComponent(), evt.getXOnScreen(), evt.getYOnScreen());
        }else{
			 Point p = evt.getPoint();	
	int rowNumber = TbFavorite.rowAtPoint( p );	
        int colNumber = TbFavorite.columnAtPoint( p );
			ListSelectionModel model = TbFavorite.getSelectionModel();
		model.setSelectionInterval( rowNumber, rowNumber );
                  FapopupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
               //   System.out.println(TbAlert.getSelectedRow());
                         DelTbFavorite[0]=TbFavorite.getValueAt(rowNumber,0 ).toString();
                        DelTbFavorite[1]=TbFavorite.getValueAt(rowNumber,1 ) .toString();
                         DelTbFavorite[2]=TbFavorite.getValueAt(rowNumber,2 ).toString();
                      
        }                 
}
}//GEN-LAST:event_TbFavoriteMouseClicked

    private void txtvalues1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtvalues1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtvalues1ActionPerformed

    private void btaddalertMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btaddalertMouseEntered
        // TODO add your handling code here:
    }//GEN-LAST:event_btaddalertMouseEntered
String GroupURL;
    private void TbGroupMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TbGroupMouseClicked
 if(SwingUtilities.isRightMouseButton(evt)){
        if(TbGroup.getRowCount()<=0){
             
              GrouppopupMenu.show(evt.getComponent(), evt.getXOnScreen(), evt.getYOnScreen());
        }else{
			 Point p = evt.getPoint();	
	int rowNumber = TbGroup.rowAtPoint( p );	
        int colNumber = TbGroup.columnAtPoint( p );
			ListSelectionModel model = TbGroup.getSelectionModel();
		model.setSelectionInterval( rowNumber, rowNumber );
                  GrouppopupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
               //   System.out.println(TbAlert.getSelectedRow());
                        GroupURL=TbGroup.getValueAt(rowNumber,6 ).toString();
                      
        }                 
}        // TODO add your handling code here:
    }//GEN-LAST:event_TbGroupMouseClicked

    private void txtportamountMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtportamountMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_txtportamountMouseClicked

    private void txtportamountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtportamountActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtportamountActionPerformed
 ArrayList<String> list = new ArrayList<String>();
 ArrayList stringList;
ArrayList stringList1;
ArrayList stringList2;
String FeedLink;String[] Col1 = {"SymbolName","Value","Chg"};

String peocessterminal="Program terminated!";
Process process[]=new Process[2];

void jarStarter() {  
  
    
        /* Start the jar-file. */   
       
        /* Get the file's output. */     
       
              process[0].destroy();
          //    process[1].destroy();  
                javax.swing.JOptionPane.showMessageDialog(null,"Program terminated! Good bye");
                
                 
          
        /* When the output becomes null, the program terminated itself. */     
        System.out.println("Program terminated!");   
   
}
Process  startJar(String jarFile, boolean mergeStreams) throws InterruptedException,IOException  {  

    /* Build the command to be executed. */  
        ArrayList<String>  command = new ArrayList<>();  
    command.add("java"); 
    command.add("-jar"); 
    command.add(jarFile);   
    ProcessBuilder builder = new ProcessBuilder(command); 
        // Map<String, String> environ = builder.environment();
     //   builder.directory(new File(System.getenv("")));
    /* Merge the error-stream into the standard output-stream. */  
    if (mergeStreams) {  
        builder.redirectErrorStream();   
    }     
    /* Start the process. */  
    process[0] = builder.start();      
        
    return  process[0];  
    
}
 Process  startJar1(String jarFile, boolean mergeStreams) throws InterruptedException,IOException  {  

    /* Build the command to be executed. */  
        ArrayList<String>  command = new ArrayList<>();  
    command.add("java"); 
    command.add("-jar"); 
    command.add(jarFile);   
    ProcessBuilder builder = new ProcessBuilder(command); 
        // Map<String, String> environ = builder.environment();
     //   builder.directory(new File(System.getenv("")));
    /* Merge the error-stream into the standard output-stream. */  
    if (mergeStreams) {  
        builder.redirectErrorStream();   
    }     
    /* Start the process. */  
    process[1] = builder.start();      
        
    return  process[1];  
    
}
static STOCK  a;
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        try {
             Properties props = new Properties(); 
             props.put("logoString", "SEDSS");
             com.jtattoo.plaf.acryl.AcrylLookAndFeel.setCurrentTheme(props);
                
        
            UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel");
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(STOCK.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            Logger.getLogger(STOCK.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            Logger.getLogger(STOCK.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnsupportedLookAndFeelException ex) {
            Logger.getLogger(STOCK.class.getName()).log(Level.SEVERE, null, ex);
        }
       
        
     

        /* Create and display the form */
    java.awt.EventQueue.invokeLater(new Runnable() {
 
          public void run() {
              new STOCK().setVisible(true);
          }});
    
          /*  a=new STOCK();           
            Toolkit tk = Toolkit.getDefaultToolkit();   
                int xSize = ((int) tk.getScreenSize().getWidth());   
                int ySize = ((int) tk.getScreenSize().getHeight());   
                a.setSize(xSize,ySize);
                a.setLocation(0,0);
               a.setVisible(true);
      
  
                  }
        //});
    /*
      JPopupMenu popup = new JPopupMenu();
           
        popup.add(News);
        popup.add(StockInfo);
        popup.add(Analysis);

        // create the right click glass pane.
        Component rc = new RightMenu(a.getContentPane(),popup);
  
       // set as glasspane and make it visible
       a.setGlassPane(rc);
        //////////////////////////////////////////
       
        
        
        ////////////////////////////////////////////
        rc.setVisible(true);
        
    */
    
 }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public static javax.swing.JCheckBox CbClose;
    public static javax.swing.JCheckBox CbEMA;
    public static javax.swing.JCheckBox CbHigh;
    public static javax.swing.JCheckBox CbLow;
    public static javax.swing.JCheckBox CbOpen;
    public static javax.swing.JCheckBox CbSMA;
    public static javax.swing.JCheckBox CbWMA;
    private javax.swing.JDesktopPane ChartCDMA;
    private javax.swing.JDesktopPane ChartCandle;
    private javax.swing.JDesktopPane ChartLine;
    private javax.swing.JDesktopPane ChartRSI;
    public static javax.swing.JCheckBox EXCandleStick;
    public static javax.swing.JCheckBox EXLineChart;
    public static javax.swing.JCheckBox EXMACD;
    private javax.swing.JCheckBox EXRSI;
    public static javax.swing.JLabel IPHostName;
    private javax.swing.JLabel LbSearch;
    public static javax.swing.JTextField MkV;
    public static javax.swing.JTextField Now;
    public static javax.swing.JTable TbAlert;
    private javax.swing.JTable TbFavorite;
    private javax.swing.JTable TbGroup;
    public static javax.swing.JTable TbListAlert;
    public static javax.swing.JTable TbNews;
    private javax.swing.JTable TbNews1;
    public static javax.swing.JTable TbPort;
    public static javax.swing.JTable TbRank;
    private javax.swing.JTable TbViewStock;
    private javax.swing.JButton btBrowser;
    private javax.swing.JButton btChart;
    private javax.swing.JButton btSearch;
    private javax.swing.JLabel btaddalert;
    public static javax.swing.JLabel btview;
    public static javax.swing.JComboBox cbAnalysis;
    private javax.swing.JComboBox cbSearch;
    public static javax.swing.JComboBox cbranktype;
    public static javax.swing.JTextField hg;
    public static javax.swing.JTextField index;
    private javax.swing.JButton jButton1;
    private javax.swing.JCheckBox jCheckBox5;
    private javax.swing.JCheckBox jCheckBox7;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel18;
    private javax.swing.JPanel jPanel19;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel20;
    private javax.swing.JPanel jPanel21;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JProgressBar jProgressBar1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JToolBar.Separator jSeparator1;
    private javax.swing.JToolBar.Separator jSeparator2;
    private javax.swing.JToolBar.Separator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    public static javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JToolBar jToolBar1;
    public static javax.swing.JLabel lbFilePath;
    private javax.swing.JLabel lbSymbol;
    public static javax.swing.JLabel lbSymbol2;
    private javax.swing.JTextField lbchange;
    private javax.swing.JTextField lbhigh;
    private javax.swing.JTextField lblow;
    private javax.swing.JTextField lbmkv;
    private javax.swing.JTextField lbpchg;
    public static javax.swing.JLabel lbranking;
    private javax.swing.JLabel lbranktype;
    private javax.swing.JTextField lbstatus;
    private javax.swing.JLabel lbtext;
    private javax.swing.JLabel lbtime;
    private javax.swing.JTextField lbtime1;
    public static javax.swing.JLabel lbtxttime;
    public static javax.swing.JLabel lbvalue2;
    private javax.swing.JLabel lbvalues;
    private javax.swing.JLabel lbvalues1;
    private javax.swing.JTextField lbvol;
    public static javax.swing.JTextField lw;
    public static javax.swing.JTextField txtGroup;
    private javax.swing.JTextField txtSearch;
    public static javax.swing.JTextField txtSymbol;
    public static javax.swing.JTextField txtSymbol3;
    public static javax.swing.JTextField txtaddport;
    public static javax.swing.JTextField txtchg;
    private javax.swing.JTextField txtfavorite;
    public static javax.swing.JTextField txtinterval;
    public static javax.swing.JTextField txtpchg;
    public static javax.swing.JTextField txtportamount;
    public static javax.swing.JTextField txtstatus;
    public static javax.swing.JTextField txtsymbol;
    public static javax.swing.JTextField txttime;
    private javax.swing.JTextField txtvalues;
    private javax.swing.JTextField txtvalues1;
    public static javax.swing.JTextField txtvol;
    public static javax.swing.JLabel txtwaiting;
    private javax.swing.JLabel txtwating;
    // End of variables declaration//GEN-END:variables
}
